From 85dc4f68ecae9adfcf9efd70d7fe721f7e1728c3 Mon Sep 17 00:00:00 2001 From: robertl Date: Mon, 20 Jan 2003 18:09:28 +0000 Subject: [PATCH] Honor -s shortnames for output. --- gpsbabel/gpsdrive.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/gpsbabel/gpsdrive.c b/gpsbabel/gpsdrive.c index 3287e5d27..b1175f320 100644 --- a/gpsbabel/gpsdrive.c +++ b/gpsbabel/gpsdrive.c @@ -137,21 +137,27 @@ gpsdrive_waypt_pr(const waypoint *wpt) { double lon,lat; char * shortname = NULL; + char *isrc, *owpt; lon = wpt->position.longitude.degrees; lat = wpt->position.latitude.degrees; - if ( wpt->shortname ) - shortname = csv_stringclean(wpt->shortname, ",\""); - - if (( shortname == NULL ) && wpt->description ) - shortname = csv_stringclean(wpt->description, ",\""); + isrc = wpt->notes ? wpt->notes : wpt->description; + if (global_opts.synthesize_shortnames) { + shortname = mkshort(mkshort_wr_handle, isrc); + } else { + if ( wpt->shortname ) + shortname = csv_stringclean(wpt->shortname, ",\""); + + if (( shortname == NULL ) && wpt->description ) + shortname = csv_stringclean(wpt->description, ",\""); - if (( shortname == NULL ) && wpt->notes ) - shortname = csv_stringclean(wpt->notes, ",\""); + if (( shortname == NULL ) && wpt->notes ) + shortname = csv_stringclean(wpt->notes, ",\""); - if ( shortname ) - shortname = mkshort(mkshort_wr_handle, shortname); + if ( shortname ) + shortname = mkshort(mkshort_wr_handle, shortname); + } fprintf(file_out, "%s %08.5f %08.5f\n", shortname, @@ -167,6 +173,7 @@ static void data_write(void) { mkshort_wr_handle = mkshort_new_handle(); + setshort_length(mkshort_wr_handle, 10); waypt_disp_all(gpsdrive_waypt_pr); mkshort_del_handle(mkshort_wr_handle); -- 2.30.2